<template>
	<view>
		<view>
			<view style="margin-top:80upx">
				<view v-for="(item,index) in leaveArr" :key="index">
					<view v-if="index%2" class="indexTeacher" @click="leaveIndexSkip(item)">
						<view style="margin-left:60upx">
							{{item.className}}
						</view>
						<view style="margin-right:20upx; font-size:24upx">
						{{item.classroom}}	>
						</view>
					</view>
					<view v-else class="indexTeacher0" @click="leaveIndexSkip(item)">
						<view style="margin-left:60upx">
							{{item.className}}
						</view>
						<view style="margin-right:20upx; font-size:24upx">
						{{item.classroom}}	>
						</view>
					</view>
					
				</view>
				<view class="attdenanceSty" @click="leaveHistory()">
					<view style="text-align: center;width:605rpx;font-size: 38rpx;">请假历史记录</view>
				</view>
			</view>
			<view class="logoSty"  ></view>
		</view>
		<!-- <my-bottom :topName="topName" :bottomArr="Attbottoms"></my-bottom>		 -->
	</view>
</template>

<script>
	import topCom from '../component/topCom.vue'
	import bottomCom from '../component/bottom.vue'
	export default {
		name:'leveRegistration',
		data(){
			return{
				url:"/pages/index/index",
				Attbottoms:[ {
				    name:'home',
				    icon:'iconfont icon-yonghutongji',
				    text:"首页",
				    path: '/pages/index/index'
				},
							
				{
				    name:'maintenance',
				    icon:'iconfont icon-shezhi',
				    text:"退出",
				    path: '/pages/index/login'
				},
				],
				userName:'',
				topName:'请假登记',
				id:'',
				leaveArr:[
					{
						icon:'',
						className:'Y34',
						classroom:'明智楼201'						
					},{
						icon:'',
						className:'Y36'	,
						classroom:'明智楼211'					
					},{
						icon:'',
						className:'Y38',
						classroom:'明智楼212'						
					},{
						icon:'',
						className:'Y40',
						classroom:'明智楼221'						
					},
				]
			}
		},
		components:{
			topCom,
			bottomCom
		},
		onShow() {
		  var that = this
		  uni.getStorage({
		  	key:'loginId',
			success:(res)=>{
				that.id = res.data
			}
		  })
		  uni.getStorage({
		  	key:"loginName",
			success:(res)=>{
				that.userName = res.data
			}
		  })
		},
		mounted(){
			this.getClassData()
		},
		methods:{
			leaveHistory(){
				uni.navigateTo({
					url:'/pages/leave/leaveHistoryList'
				})
			},
			getClassData(){
				uni.request({
					url:uni.url+"Class/getClassListByTeacherId?loginId="+this.id,
					success:res=>{
						this.leaveArr = res.data.data;
					}
				})
					 // this.$api.teacher.tecClassList(this.id).then(res=>{
						//  this.leaveArr = res.data						
					 // }).catch(e=>{
						 
					 // })
					
			},
			leaveIndexSkip(item){
				uni.navigateTo({
					url: `/pages/leave/leaveManagement?classId=${item.classId}&className=${item.className}`,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>
	.attdenanceSty{
		margin: auto;
		margin-top:40upx;
		width:605upx;
		height:72upx;
		display: flex;
		justify-content: space-between;
		background-color: #FF0088;
		color:white;
		padding-top:30upx;
		font-size: 32upx;
		border-radius: 20rpx;
	}
	.indexTeacher{
		margin: auto;
		margin-top:40upx;
		width:605upx;
		height:72upx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-4.png);
		background-size: 100%;
		color:white;
		padding-top:30upx;
		font-size: 38rpx;
		/* opacity: 0.8; */
	}
	.indexTeacher0{
		margin: auto;
		margin-top:40upx;
		width:605upx;
		height:72upx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-6.png);
		background-size: 100%;
		color:white;
		padding-top:30upx;
		font-size: 38rpx;
		/* opacity: 0.8; */
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>
